import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';

class MainViewModel extends GetxController {
  ///页面切换的索引
  final RxInt currentIndex = 0.obs;

  ///pageView 控制器
  final PageController pageController = PageController();

  void onPageChange(int index) => currentIndex(index);

  void bottomNavigationBarTap(int? index) {
    currentIndex(index!);
    pageController.animateToPage(index, duration: Duration(milliseconds: 200), curve: Curves.ease);
  }
}
